const {app, BrowserWindow, Menu} = require('electron');
const path = require('path');

//Create native application menus and context menus.
//https://www.electronjs.org/docs/latest/api/menu

app.on('ready', () => {
  let win = new BrowserWindow({
    //https://www.electronjs.org/docs/latest/api/browser-window#new-browserwindowoptions
 width: 802,
    height: 550,

    webPreferences: {
      nodeIntegration: true,
      // contextIsolation: true,
      // enableRemoteModule: false,
      // devTools: true
    }
  });

  //Sets menu as the application menu on macOS.
  //On Windows and Linux, the menu will be set as each window's top menu.


  //Passing null will suppress the default menu. On Windows and Linux, this has the additional effect of removing the menu bar from the window.
  //windows 设置null 会隐藏顶部菜单
  // Menu.setApplicationMenu(null);

  // Note: The default menu will be created automatically if the app does not set one. It contains standard items such as File, Edit, View, Window and Help.
  //什么都不做, 会有一个默认菜单 详见 README.md


  //todo
  // Also on Windows and Linux, you can use a & in the top-level item name to indicate which letter should get a generated accelerator. For example, using &File for the file menu would result in a generated Alt-F accelerator that opens the associated menu. The indicated character in the button label then gets an underline, and the & character is not displayed on the button label.
  // In order to escape the & character in an item name, add a proceeding &. For example, &&File would result in &File displayed on the button label.



  win.loadFile(path.resolve(__dirname,'index.html'))
});
